import store from '@/store'
import vue from '../main'
const formData = (arr) =>{
    console.log(arr)
}
const dataBeanUntils = (data,dataLoad) => {
    //console.log(data,dataLoad)
    let dataOld = {...data},dataNew = {...dataLoad};
    for(let i in dataOld){
        for(let j in dataLoad){
            if(i==j){
                let d_o_item = dataOld[i],d_n_item = dataNew[j];
                if(d_n_item == null || d_n_item ==''){
                    dataOld[i] = d_o_item
                }else{
                    if(typeof d_o_item == 'object'){
                        dataOld[i] = JSON.parse(d_n_item);
                    }else{
                        if(i == 'nationality'){
                            dataOld[i] = d_n_item.code
                        }else{
                            dataOld[i] = d_n_item
                        }
                    }
                }
            }
        }
    };
    return dataOld
}
const returnData = (dataLoad)=>{
    let form = {};
    dataLoad.forEach(idt=>{
        form[idt.name] = idt.value
    });
    form.correlationid = store.state.userInfo.correlationid;
    //form.language = vue.$i18n.locale;
    return form
}
export default {
    formData,dataBeanUntils,returnData
}
